<?php

declare(strict_types=1);

namespace App\Request\Index;

use App\Request\BaseCommonRequest;
use Hyperf\Context\Context;
use Hyperf\Validation\Request\FormRequest;

class ClickHeartBeatRequest extends BaseCommonRequest
{
    public function authorize(): bool
    {
        return true;
    }

    public function rules(): array
    {
        return [
            'click_time' => 'filled|integer',
        ];
    }


    /**
     * 获取已定义验证规则的错误消息
     */
    public function messages(): array
    {
        $language = Context::get('language', 'en');
        if ($language == 'zh-cn') {
            return [
                'click_time.filled' => '点击时间不能为空值',
                'click_time.integer' => '点击时间必须为整数',
            ];
        } elseif ($language == 'zh-hk') {
            return [
                'click_time.filled' => '点击时间不能為空值',
                'click_time.integer' => '点击时间必須為整數',
            ];
        } else {
            return [
                'click_time.filled' => 'Click time cannot be an empty value',
                'click_time.integer' => 'Click time must be an integer',
            ];
        }

    }

}